// const baseUrl = 'http://172.27.13.155:7400';
// const baseUrl = 'http://prod.scgjcx.com:7500';
// const baseUrl = 'https://prod.hbytzc.cn';
const baseUrl = 'https://snpl.scgjcx.com/api';
// const baseUrl = 'http://49.4.3.26:7500';

export const request = (object) => {
	const token = uni.getStorageSync('token');
	return uni.request({
		url: `${baseUrl}${object.path}`,
		method: `${object.method}`,
		header: {
			'Content-Type': 'application/json',
			'Authorization': token
		},
		dataType: 'json',
		responseType: 'text',
		...object,
		complete: res => {
			if (res.statusCode === 401) {
				uni.redirectTo({
					url: '/pages/login/index'
				});
			}
		}
	});
}


